#!/bin/sh
# DTV Admin Dashboard Production Startup Script

set -e

echo "🚀 Starting DTV Admin Dashboard in Production Mode..."

# Load environment variables if they exist
if [ -f .env.production ]; then
    echo "📝 Loading production environment variables..."
    export $(grep -v '^#' .env.production | xargs)
fi

# Set default values
export HOSTNAME=${HOSTNAME:-0.0.0.0}
export PORT=${PORT:-3000}

echo "🌟 Starting Next.js application..."
echo "   Hostname: $HOSTNAME"
echo "   Port: $PORT"
echo "   Node Environment: $NODE_ENV"
echo "   API Base URL: $NEXT_PUBLIC_API_BASE_URL"

# Start the Next.js application
exec node server.js